package pv.dto;

import org.json.JSONException;
import org.json.JSONObject;

public class PlaceDTO extends AbstractDTO {
	int id;
	int category_id;
	int sub_category_id;
	String latitude;
	String longitude;
	String name;
	String numberOf;
	String street;
	int ward_id;
	int district_id;
	int province_id;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getCategory_id() {
		return category_id;
	}

	public void setCategory_id(int category_id) {
		this.category_id = category_id;
	}

	public int getSub_category_id() {
		return sub_category_id;
	}

	public void setSub_category_id(int sub_category_id) {
		this.sub_category_id = sub_category_id;
	}

	public String getLatitude() {
		return latitude;
	}

	public void setLatitude(String latitude) {
		this.latitude = latitude;
	}

	public String getLongitude() {
		return longitude;
	}

	public void setLongitude(String longitude) {
		this.longitude = longitude;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getNumberOf() {
		return numberOf;
	}

	public void setNumberOf(String numberOf) {
		this.numberOf = numberOf;
	}

	public String getStreet() {
		return street;
	}

	public void setStreet(String street) {
		this.street = street;
	}

	public int getWard_id() {
		return ward_id;
	}

	public void setWard_id(int ward_id) {
		this.ward_id = ward_id;
	}

	public int getDistrict_id() {
		return district_id;
	}

	public void setDistrict_id(int district_id) {
		this.district_id = district_id;
	}

	public int getProvince_id() {
		return province_id;
	}

	public void setProvince_id(int province_id) {
		this.province_id = province_id;
	}

	public PlaceDTO(int category_id, int sub_category_id, String latitude,
			String longitude, String name, String numberOf, String street,
			int ward_id, int district_id, int province_id) {
		super();
		// this.id = id;
		this.category_id = category_id;
		this.sub_category_id = sub_category_id;
		this.latitude = latitude;
		this.longitude = longitude;
		this.name = name;
		this.numberOf = numberOf;
		this.street = street;
		this.ward_id = ward_id;
		this.district_id = district_id;
		this.province_id = province_id;
	}

	public PlaceDTO() {

	}

	public static PlaceDTO converFromJSON(JSONObject jsonObject)
			throws JSONException {
		if (jsonObject == null)
			return null;
		int id = -1;
		int category_id = jsonObject.getInt("category_id");
		int sub_category_id = jsonObject.getInt("sub_category_id");
		String latitude = jsonObject.getString("latitude");
		String longitude = jsonObject.getString("longitude");
		String name = jsonObject.getString("name");
		String numberOf = jsonObject.getString("numberOf");
		String street = jsonObject.getString("street");
		int ward_id = jsonObject.getInt("ward_id");
		int district_id = jsonObject.getInt("district_id");
		int province_id = jsonObject.getInt("province_id");
		PlaceDTO result = new PlaceDTO(category_id, sub_category_id, latitude,
				longitude, name, numberOf, street, ward_id, district_id,
				province_id);
		return result;
	}

}
